home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / Shaders / RCShaders / RCTxtPlastic.sl < prev    next >
Encoding:
Text File  |  1995-03-22  |  538 b   |  26 lines

  1. /* Listing 16.29  Plastic surface shader using a texture map*/
  2. /* 
  3.  *  txtplastic(): version of plastic() shader using an optional texture map
  4.  */
  5. surface 
  6. RCTxtPlastic( 
  7.     float    Ks        = .5, 
  8.         Kd        = .5, 
  9.         Ka        =  1, 
  10.         roughness    = .1;
  11.     color     specularcolor = 1;
  12.     string    mapname = "")
  13. {
  14.     point    Nf = faceforward( N, I );
  15.  
  16.     if( mapname != "" )
  17.         Ci = color texture( mapname );                        /* Use s and t */
  18.     else
  19.         Ci = Cs;
  20.     Oi = Os;
  21.     Ci = Os * ( Ci * 
  22.             (Ka*ambient() + Kd*diffuse(Nf)) 
  23.          + specularcolor * Ks * specular(Nf,-I,roughness) );
  24. }
  25.  
  26.